﻿using Shiloh.Job.Model.Entities;
using Shiloh.Job.Model.Enums;
using Shiloh.Job.Repositories;
using Shiloh.Job.Services.Interfaces;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Shiloh.Job.Services.Implementations
{
    public class LogService : ILogServce
    {
        private Repository<ActionLog> _repository;
        
        public LogService(Repository<ActionLog> repository)
        {
            _repository = repository;
        }
        public async Task AddLoginFailLog(Guid id)
        {
            var log = ActionLogFactory.CreateLog(id,"",ActionLogTypeEnum.登录,DeviceTypeEnum.PC,false);
            await _repository.InsertAsync(log);
        }

        public async Task AddLoginSuccessLog(Guid id)
        {
            var log = ActionLogFactory.CreateLog(id, "", ActionLogTypeEnum.登录, DeviceTypeEnum.PC, true);
            await _repository.InsertAsync(log);
        }

        public Task<int> GetFailLogIn30Min()
        {
            throw new NotImplementedException();
        }
    }
}
